package com;

import java.util.Arrays;

public class Solution {
    public static void main(String[] args) {
        String s1="dba",s2="abcd";
        int k=s1.length();
        int[]a1=new int[26];
        int[]a2=new int[26];
        for(Character c:s1.toCharArray())
            a1[c-'a']++;
        for(int i =0;i<k;i++){
            a2[s2.charAt(i)-'a']++;
        }
        if(Arrays.equals(a1, a2)){
            System.out.println(true);
            return;
        }
        for(int i = k;i<s2.length();i++){
            a2[s2.charAt(i-k)-'a']--;
            a2[s2.charAt(i)-'a']++;
            if(Arrays.equals(a1, a2)){
                System.out.println(true);
                return;
            }
        }
        System.out.println(false);
    }
}